package com.w2cx.selenium.page;

import com.w2cx.selenium.base.DriverBase;
import com.w2cx.selenium.util.Locator;
import org.openqa.selenium.WebElement;

import java.util.List;

public class SensitiveWordsManagePage extends BasePage {

    DriverBase driver;
    public SensitiveWordsManagePage(DriverBase driver){
        super(driver);
    }

    //获取“基础数据管理”菜单
    public WebElement getBaseDataManageMenu(){
        List<WebElement> list = elements(Locator.getByLocator("firstMenuList"));
        WebElement element = list.get(3);
        System.out.println("找到元素:"+element.getText());
        return element;
    }

    //获取“敏感词管理”菜单
    public WebElement getSensiWordManageMenu(){
        List<WebElement> list = elements(Locator.getByLocator("BaseDataSecondMenu"));
        WebElement element = list.get(2);
        System.out.println("找到元素:"+element.getText());
        return element;
    }

    //获取“添加敏感词”按钮
    public WebElement getAddSensitiveWordBtn(){
        List<WebElement> list = elements(Locator.getByLocator("addSensitiveWordBtn"));
        WebElement addBtn = list.get(0);
        System.out.println("找到元素:"+addBtn.getText());
        return addBtn;
    }

    //获取“敏感词”输入框
    public WebElement getSensiWorkInput(){
        WebElement sensiWordInput = element(Locator.getByLocator("sensitiveWordInput"));
        System.out.println("找到元素:"+sensiWordInput.getText());
        return sensiWordInput;
    }

    //获取“确定”按钮
    public WebElement getAddConfirmBtn(){
        WebElement confirmBtn = element(Locator.getByLocator("sensitiveWordAddConfirmBtn"));
        System.out.println("找到元素:"+confirmBtn.getText());
        return confirmBtn;
    }

    //获取第一级别列表
    public List<WebElement> getSensiWordLevel0List(){
        List<WebElement> sensiWordLevel0List = elements(Locator.getByLocator("sensiWordLevel0List"));
        return sensiWordLevel0List;
    }


    //获取要删除元素对应的“删除”按钮
    public WebElement getSensiWordDelBtn(WebElement Element){

      WebElement element = Element.findElement(Locator.getByLocator("sensitiveDelBtn"));
        System.out.println("找到元素:"+element.getText());
      return element;

    }

    //获取删除对话框中“确定”按钮
    public WebElement getSensiDelConfirmBtn(){
        WebElement element = element(Locator.getByLocator("sensiDelConfirmBtn"));
        System.out.println("找到元素:"+element.getText());
        return element;
    }






}
